'use strict';
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	//连接数据库
		const db=uniCloud.database();
	 
		var userId=event.userId;
		 //查找云数据库表，User是表名
			let result=await db.collection('user').where({
				_id:userId
			}).get();
			console.log(result)
			if(result.affectedDocs==0){
				return{
					code:400,
					msg:"用户不存在"
				}
			}else{
				return{
					code:200,
					msg:"查询成功",
					data:result.data[0]
				}
			}
	//返回数据给客户端
	return event
};
